<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml"
	xmlns:ui="http://java.sun.com/jsf/facelets"
	xmlns:h="http://java.sun.com/jsf/html"
	xmlns:f="http://java.sun.com/jsf/core"
	xmlns:p="http://primefaces.org/ui" class="no-js">

<ui:composition template="startTemplate.xhtml">
	
	<ui:define name="title">
		<h:outputText value="#{i18n.applicationLabel}" />
	</ui:define>
	
	<ui:define name="content">		
	    
	    <!-- **************************************** Application table **************************************** -->
		
		<div class="span32">	
		<h:form id="applicationForm" prependId="false">	
			<p:growl id="applicationGrowl" />
				
			<p:dataTable id="dataTableAllApplication" value="#{listBean.listApplication}" var="a">  			    
			    <f:facet name="header">
			    	<h:outputText value="#{i18n.listApplicationLabel}" />			    	
			    </f:facet>
			    <p:column style="width:2%">  
		            <p:rowToggler />		            	  
		        </p:column>  
			    <p:column headerText="#{i18n.applicationIdLabel}">  
		            <h:outputText value="#{a.idApplication}" />  
		        </p:column>
		        <p:column headerText="#{i18n.applicationNameLabel}"> 		            
				    <h:outputText value="#{a.name}" /> 
		        </p:column>		
		        <p:column headerText="#{i18n.details}">  
		        	<p:commandLink id="applicationLink" ajax="true"
		        		update=":detailApplicationForm:panelDetailApplication">		            	
		            	<h:outputText styleClass="ui-icon ui-icon-search" style="margin:0 auto;" /> 						 
						<f:setPropertyActionListener target="#{applicationBean.applicationView}" value="#{a}" /> 									          
				    </p:commandLink>   
		        </p:column>	
		        
		        <p:rowExpansion>  
		            <p:dataList id="dataListModuleByApplication" value="#{a.listComposition}" var="c" itemType="disc">
						<f:facet name="header">
							<h:outputText value="#{i18n.listModuleLabel}" />
						</f:facet>				
						<p:commandLink id="dataListModuleByApplicationLink" ajax="true"
							update=":detailModuleForm:panelDetailModule, :updateModuleForm:updateModuleDialog">							
							<f:setPropertyActionListener target="#{moduleBean.moduleView}" value="#{c.module}" />
								  
					        <h:outputText value="#{c.module.name}" />  
					    </p:commandLink> 
					    <f:facet name="footer">								
							<p:commandButton id="showComposition" value="#{i18n.compositionLabel}" icon="ui-icon-plus"
								update=":compositionForm:compositionDialog" oncomplete="compositionDlg.show()">
								<f:setPropertyActionListener target="#{compositionBean.compositionNew.application}" value="#{a}" />
							</p:commandButton>
							<p:commandButton id="showPdfModuleHistory" icon="ui-icon-plus" value="#{i18n.generatePdf}"
								action="#{moduleBean.createModuleHistoryTable}" oncomplete="pdfModuleHistoryDlg.show()"
								update=":pdfModuleHistoryForm:pdfModuleHistory">
								<f:setPropertyActionListener target="#{moduleBean.application}" value="#{a}" />								
							</p:commandButton>  
						</f:facet>			         		    
					</p:dataList>  	  		
		        </p:rowExpansion>
		        
		        <f:facet name="footer">
		        	<p:commandButton id="showAddModule" value="#{i18n.addModuleLabel}" icon="ui-icon-plus"
						update=":newModuleForm:newModuleDialog" oncomplete="newModuleDlg.show()" />								
			    	<p:commandButton id="showAddApplication" value="#{i18n.addApplicationLabel}" icon="ui-icon-plus"
						update=":newApplicationForm:newApplicationDialog" oncomplete="newApplicationDlg.show()" />
			    </f:facet>   
			</p:dataTable>  			
		</h:form>		
		</div>	
		
	    <!-- **************************************** Dialog composition **************************************** -->
	    		
		<h:form id="compositionForm">
			<p:growl id="compositionGrowl" showDetail="true" />			
			
		    <p:dialog id="compositionDialog" header="#{i18n.compositionLabel}" widgetVar="compositionDlg" 
		    	dynamic="true" showEffect="clip" hideEffect="scale">	
				<h:panelGrid id="compositionPanel" columns="2" styleClass="panel">
					
					<p:selectOneMenu value="#{compositionBean.compositionNew.module}" filter="true" filterMatchMode="startsWith"
						id="applicationType" required="true"
						converter="#{moduleConverterBean}" validator="#{moduleValidator.validate}"> 	
						<f:passThroughAttribute name="required" value="true" />
						<f:selectItem itemLabel="Select One" itemValue="Select One" />							            	            
			            <f:selectItems value="#{listBean.listModule}" var="m" itemLabel="#{m.name}" itemValue="#{m}" />			           	            	
			        </p:selectOneMenu>
	
					<f:facet name="footer">
			            <h:panelGroup style="display:block; text-align:center">
			                <p:commandButton id="compositionFormSubmit" action="#{compositionBean.create}" value="#{i18n.submit}"
			                	oncomplete="compositionDlg.hide()" update="compositionGrowl, 
			                	:applicationForm:dataTableAllApplication, :compositionForm:compositionDialog" />
			            </h:panelGroup>
			        </f:facet>	
			        			
				</h:panelGrid>
			</p:dialog>
		</h:form>
		
		<!-- **************************************** Dialog pdf module history **************************************** -->
		
		<h:form id="pdfModuleHistoryForm">
			<p:growl id="pdfModuleHistoryGrowl" />          		
			        
		    <p:dialog id="pdfModuleHistoryDialog" header="#{i18n.pdfModuleHistory} #{pdfBean.application.name}" 
		    	widgetVar="pdfModuleHistoryDlg" dynamic="true" showEffect="clip" hideEffect="scale">					        
		        <p:dataTable id="pdfModuleHistory" binding="#{pdfBean.table}" var="mh" 
		        	value="#{moduleBean.list4pdf}" rowIndexVar="count">
		        	 
		        	<f:facet name="header">
		        		<h:panelGrid id="newStatusPanel" columns="1" styleClass="panel">  
			            	<h:outputText value="#{moduleBean.application.name}" />
			            </h:panelGrid>
			        </f:facet>   
			        
				    <p:column>  
				        <f:facet name="header">  
				            <h:outputText value="#{i18n.updateType}" />  
				        </f:facet>  
				        <h:outputText value="#{mh.module.type.name}" />  
				    </p:column>
				    
				    <p:column>  
				        <f:facet name="header">  
				            <h:outputText value="#{i18n.moduleNameLabel}" />  
				        </f:facet>  
				        <h:outputText value="#{mh.module.name}" />  
				    </p:column>
				    
				    <p:column>  
				        <f:facet name="header">  
				            <h:outputText value="#{i18n.oldVersionLabel}" />  
				        </f:facet>  
				        <h:outputText value="#{mh.version}" />  
				    </p:column>
				    
				    <p:column>  
				        <f:facet name="header">  
				            <h:outputText value="#{i18n.newVersionLabel}" />  
				        </f:facet>  
				        <h:outputText value="#{mh.nextVersion}" />  
				    </p:column>
				    
				    <p:column>  
				        <f:facet name="header">  
				            <h:outputText value="#{i18n.versionDateLabel}" />  
				        </f:facet>  
				        <h:outputText value="#{mh.date}">
				        	<f:convertDateTime pattern="dd/MM/yyyy" />
				        </h:outputText>  
				    </p:column>
				    
				    <p:column>  
				        <f:facet name="header">  
				            <h:outputText value="#{i18n.statusAndTest}" />  
				        </f:facet>  
				        <h:outputText value="Ok" />				        	
				    </p:column>
				    
				    <f:facet name="footer">			            
		            	<p:selectOneMenu value="#{pdfBean.email}" id="pdfModuleHistoryEmail" required="true"
		            		onchange="enablePdf();">								 	
							<f:passThroughAttribute name="required" value="true" />
							<f:selectItem itemLabel="Select One" itemValue="Select One" />							            	            
				            <f:selectItems value="#{moduleBean.listEmail}" />			           	            	
				        </p:selectOneMenu>
		            	<p:commandLink update=":pdfModuleHistoryForm:pdfModuleHistoryGrowl" oncomplete="pdfModuleHistoryDlg.hide()"
		            		ajax="false" action="#{pdfBean.processPDF}" id="processPdfLink"> 		            		
		            		<f:setPropertyActionListener target="#{pdfBean.application}" value="#{moduleBean.application}" />
				            <p:graphicImage value="/resources/img/pdf.gif" />					              
				        </p:commandLink>			            
			        </f:facet>	
			        
				</p:dataTable>				        
		    </p:dialog>			
		</h:form>
		
	    <!-- **************************************** Dialog new type **************************************** -->
	    		
		<h:form id="newTypeForm">
			<p:growl id="typeGrowl" showDetail="true" />			
			
		    <p:dialog id="newTypeDialog" header="#{i18n.newTypeLabel}" widgetVar="newTypeDlg" 
		    	dynamic="true" showEffect="clip" hideEffect="scale">	
				<h:panelGrid id="newTypePanel" columns="2" styleClass="panel">
					
					<h:outputLabel id="typeNameLabel" for="typeName"
						value="#{i18n.typeNameLabel}" />
					<h:inputText id="typeName" value="#{typeBean.type.name}" />
	
					<f:facet name="footer">
			            <h:panelGroup style="display:block; text-align:center">
			                <p:commandButton id="newTypeFormSubmit" action="#{typeBean.create}" value="#{i18n.submit}"
			                	oncomplete="newTypeDlg.hide()" update="typeGrowl, 
			                	:newApplicationForm:applicationType, :newModuleForm:moduleType,
			                	:updateApplicationForm:applicationTypeUpdate, :updateModuleForm:moduleTypeUpdate" />
			            </h:panelGroup>
			        </f:facet>	
			        			
				</h:panelGrid>
			</p:dialog>
		</h:form>
		
		<!-- **************************************** Dialog new application **************************************** -->
		
		<h:form id="newApplicationForm">						        
		    <p:dialog id="newApplicationDialog" header="#{i18n.newApplicationLabel}" widgetVar="newApplicationDlg" 
		    	dynamic="true" showEffect="clip" hideEffect="scale">	
				<h:panelGrid id="newApplicationPanel" columns="2" styleClass="panel">
					
					<h:outputLabel id="applicationIdLabel" for="applicationId"
						value="#{i18n.applicationIdLabel}" />
					<h:inputText id="applicationId" value="#{applicationBean.applicationNew.idApplication}" required="true">
						<f:passThroughAttribute name="required" value="true" />
					</h:inputText>
					
					<h:outputLabel id="applicationNameLabel" for="applicationName"
						value="#{i18n.applicationNameLabel}" />
					<h:inputText id="applicationName" value="#{applicationBean.applicationNew.name}" required="true">
						<f:passThroughAttribute name="required" value="true" />
					</h:inputText>
	
					<h:outputLabel id="applicationTypeLabel" for="applicationType"
						value="#{i18n.typeNameLabel}" />
					<h:panelGroup>									
						<p:selectOneMenu value="#{applicationBean.applicationNew.type}" filter="true" filterMatchMode="startsWith" id="applicationType" 
							converter="#{typeConverterBean}" validator="#{typeValidator.validate}" required="true"> 	
							<f:passThroughAttribute name="required" value="true" />
							<f:selectItem itemLabel="Select One" itemValue="Select One" />							            	            
				            <f:selectItems value="#{listBean.listType}" var="type" itemLabel="#{type.name}" itemValue="#{type}" />			           	            	
				        </p:selectOneMenu>
				        <p:commandButton id="showAddTypeNA" icon="ui-icon-plus" 
							type="button" onclick="newTypeDlg.show()" />  			        
			        </h:panelGroup>
			        
					<h:outputLabel id="applicationVersionNameLabel" for="applicationVersionName"
						value="#{i18n.versionNameLabel}" />
					<h:inputText id="applicationVersionName" value="#{applicationBean.applicationNew.version}" required="true">
						<f:passThroughAttribute name="required" value="true" />
					</h:inputText>
										
					<h:outputLabel id="applicationVersionDateLabel" for="applicationVersionDate"
						value="#{i18n.versionDateLabel}" />
					<p:calendar id="applicationVersionDate" value="#{applicationBean.applicationNew.date}" 
						pattern="dd/MM/yyyy" mode="popup" size="19" required="true">					
						<f:convertDateTime pattern="dd/MM/yyyy" />
						<f:passThroughAttribute name="required" value="true" />					
					</p:calendar>					
					
					<h:outputLabel id="applicationVersionPriceLabel" for="applicationVersionPrice"
						value="#{i18n.versionPriceLabel}" />
					<h:inputText id="applicationVersionPrice" value="#{applicationBean.applicationNew.price}">
						<f:convertNumber minFractionDigits="2" />
					</h:inputText>
										
					<h:outputLabel id="applicationToDoLabel" for="applicationToDo"
						value="#{i18n.toDoLabel}" />
					<p:inputTextarea id="applicationToDo" value="#{applicationBean.applicationNew.toDo}" rows="3" cols="19" />
					
					<h:outputLabel id="applicationCommentsLabel" for="applicationComments"
						value="#{i18n.commentsLabel}" />
					<p:inputTextarea id="applicationComments" value="#{applicationBean.applicationNew.comments}" rows="3" cols="19" />
						
					<f:facet name="footer">
			            <h:panelGroup style="display:block; text-align:center">
			                <p:commandButton id="newApplicationFormSubmit" action="#{applicationBean.create}" value="#{i18n.submit}"
			                	update=":applicationForm:applicationGrowl, :applicationForm:dataTableAllApplication"
			                	oncomplete="newApplicationDlg.hide()" />
			            </h:panelGroup>
			        </f:facet>	
			        			
				</h:panelGrid>
			</p:dialog>
		</h:form>	 
		
		<!-- **************************************** Dialog new module **************************************** -->
		
		<h:form id="newModuleForm">			
		    <p:dialog id="newModuleDialog" header="#{i18n.newModuleLabel}" widgetVar="newModuleDlg" 
		    	dynamic="true" showEffect="clip" hideEffect="scale">	
				<h:panelGrid id="newModulePanel" columns="2" styleClass="panel">
					
					<h:outputLabel id="moduleIdLabel" for="moduleId"
						value="#{i18n.moduleIdLabel}" />
					<h:inputText id="moduleId" value="#{moduleBean.moduleNew.idModule}" required="true">
						<f:passThroughAttribute name="required" value="true" />
					</h:inputText>
					
					<h:outputLabel id="moduleNameLabel" for="moduleName"
						value="#{i18n.moduleNameLabel}" />
					<h:inputText id="moduleName" value="#{moduleBean.moduleNew.name}" required="true">
						<f:passThroughAttribute name="required" value="true" />
					</h:inputText>
	
					<h:outputLabel id="moduleTypeLabel" for="moduleType"
						value="#{i18n.typeNameLabel}" />
					<h:panelGroup>									
						<p:selectOneMenu value="#{moduleBean.moduleNew.type}" filter="true" filterMatchMode="startsWith" id="moduleType" 
							converter="#{typeConverterBean}" validator="#{typeValidator.validate}" required="true"> 	
							<f:passThroughAttribute name="required" value="true" />	
							<f:selectItem itemLabel="Select One" itemValue="Select One" />						            	            
				            <f:selectItems value="#{listBean.listType}" var="type" itemLabel="#{type.name}" itemValue="#{type}" />			           	            	
				        </p:selectOneMenu>
				        <p:commandButton id="showAddTypeNM" icon="ui-icon-plus" 
								type="button" onclick="newTypeDlg.show()" />  			        
			        </h:panelGroup> 	
												
					<h:outputLabel id="moduleVersionNameLabel" for="moduleVersionName"
						value="#{i18n.versionNameLabel}" />
					<h:inputText id="moduleVersionName" value="#{moduleBean.moduleNew.version}" required="true">
						<f:passThroughAttribute name="required" value="true" />
					</h:inputText>
										
					<h:outputLabel id="moduleVersionDateLabel" for="moduleVersionDate"
						value="#{i18n.versionDateLabel}" />
					<p:calendar id="moduleVersionDate" value="#{moduleBean.moduleNew.date}" 
						pattern="dd/MM/yyyy" mode="popup" size="19" required="true">					
						<f:convertDateTime pattern="dd/MM/yyyy" />
						<f:passThroughAttribute name="required" value="true" />					
					</p:calendar>					
					
					<h:outputLabel id="moduleVersionPriceLabel" for="moduleVersionPrice"
						value="#{i18n.versionPriceLabel}" />
					<h:inputText id="moduleVersionPrice" value="#{moduleBean.moduleNew.price}">
						<f:convertNumber minFractionDigits="2" />
					</h:inputText>
										
					<h:outputLabel id="moduleToDoLabel" for="moduleToDo"
						value="#{i18n.toDoLabel}" />
					<p:inputTextarea id="moduleToDo" value="#{moduleBean.moduleNew.toDo}" rows="3" cols="19" />
					
					<h:outputLabel id="moduleCommentsLabel" for="moduleComments"
						value="#{i18n.commentsLabel}" />
					<p:inputTextarea id="moduleComments" value="#{moduleBean.moduleNew.comments}" rows="3" cols="19" />
						
					<f:facet name="footer">
			            <h:panelGroup style="display:block; text-align:center">
			                <p:commandButton id="newModuleFormSubmit" action="#{moduleBean.create}" value="#{i18n.submit}"
			                	update=":applicationForm:applicationGrowl, :applicationForm:dataTableAllApplication" 
			                	oncomplete="newModuleDlg.hide()" />
			            </h:panelGroup>
			        </f:facet>	
			        			
				</h:panelGrid>
			</p:dialog>
		</h:form>	 
		
		<!-- **************************************** Application Details **************************************** -->
	
		<div class="span66">			
			<h:form id="detailApplicationForm" prependId="false">
				<p:panel header="#{i18n.applicationDetailLabel}" id="panelDetailApplication">
					<h:panelGrid columns="2">
						<h:outputLabel value="#{i18n.applicationIdLabel}" />
						<h:outputText value="#{applicationBean.applicationView.idApplication}" />
						
						<h:outputLabel value="#{i18n.applicationNameLabel}" />
						<h:outputText value="#{applicationBean.applicationView.name}" />
						
						<h:outputLabel value="#{i18n.typeNameLabel}" />
						<h:outputText value="#{applicationBean.applicationView.type.name}" />
						
						<h:outputLabel value="#{i18n.versionNameLabel}" />
						<h:outputText value="#{applicationBean.applicationView.version}" />
						
						<h:outputLabel value="#{i18n.versionDateLabel}" />
						<h:outputText value="#{applicationBean.applicationView.date}">
							<f:convertDateTime pattern="dd/MM/yyyy" />
						</h:outputText>
						
						<h:outputLabel value="#{i18n.versionPriceLabel}" />
						<h:outputText value="#{applicationBean.applicationView.price}">
							<f:convertNumber minFractionDigits="2" />
						</h:outputText>
						
						<h:outputLabel value="#{i18n.toDoLabel}" />
						<h:outputText value="#{applicationBean.applicationView.toDo}" />
						
						<h:outputLabel value="#{i18n.commentsLabel}" />
						<h:outputText value="#{applicationBean.applicationView.comments}" />
						
						<f:facet name="footer">
							<p:commandButton id="showUpdateApplication" value="#{i18n.update}" icon="ui-icon-wrench"
								 update=":updateApplicationForm:updateApplicationDialog" 
								 action="#{applicationBean.toggleUpdate}" oncomplete="updateApplicationDlg.show()" />														 
							<p:commandButton id="deleteApplicationSubmit" value="#{i18n.delete}" icon="ui-icon-trash"
								action="#{applicationBean.delete}" update=":applicationForm:applicationGrowl,
								:applicationForm:dataTableAllApplication, :detailApplicationForm:panelDetailApplication" />
						</f:facet>
					</h:panelGrid>
				</p:panel>
			</h:form>
			
		<!-- **************************************** Dialog Application update **************************************** -->
				
			<h:form id="updateApplicationForm" prependId="false">
				<p:dialog id="updateApplicationDialog" header="#{i18n.updateApplicationLabel}" widgetVar="updateApplicationDlg" 
			    	dynamic="true" showEffect="clip" hideEffect="scale">
			    	<p:panelGrid id="updateApplicationPanel" styleClass="span91">  					    				    
						<p:row>  
		        			<p:column> 
								<h:outputLabel id="applicationNameLabelUpdate" for="applicationNameUpdate"
									value="#{i18n.applicationNameLabel} " />
							</p:column>
							<p:column styleClass="center">
								<h:inputText id="applicationNameUpdate" value="#{applicationBean.applicationUpdate.name}">
									<f:passThroughAttribute name="required" value="true" />					
								</h:inputText>
							</p:column>
						</p:row>
						<p:row>  
		        			<p:column> 
								<h:outputLabel id="applicationTypeLabelUpdate" for="applicationTypeUpdate"
									value="#{i18n.typeNameLabel} " />
							</p:column>
							<p:column styleClass="center">
								<h:panelGroup>
									<p:selectOneMenu value="#{applicationBean.applicationUpdate.type}" id="applicationTypeUpdate" 
										filter="true" filterMatchMode="startsWith" required="true"
										converter="#{typeConverterBean}" validator="#{typeValidator.validate}"> 	
										<f:passThroughAttribute name="required" value="true" />	
										<f:selectItem itemLabel="Select One" itemValue="Select One" />														            	            
							            <f:selectItems value="#{listBean.listType}" var="type" 
							            	itemLabel="#{type.name}" itemValue="#{type}" />			           	            	
							        </p:selectOneMenu>
							        <p:commandButton id="showAddTypeUA" icon="ui-icon-plus" 
										type="button" onclick="newTypeDlg.show()" />  			        
					        	</h:panelGroup> 																
							</p:column>
						</p:row>
						<p:row>  
		        			<p:column> 
								<h:outputLabel id="applicationVersionLabelUpdate" for="applicationVersionUpdate"
									value="#{i18n.versionNameLabel} " />
							</p:column>
							<p:column styleClass="center">
								<h:inputText id="applicationVersionUpdate" value="#{applicationBean.applicationUpdate.version}" />															
							</p:column>
						</p:row>
						<p:row>  
		        			<p:column> 
								<h:outputLabel id="applicationDateVersionLabelUpdate" for="applicationDateVersionUpdate"
									value="#{i18n.versionDateLabel} " />
									
							</p:column>
							<p:column styleClass="center">								
								<p:calendar id="applicationDateVersionUpdate" value="#{applicationBean.applicationUpdate.date}" 
									pattern="dd/MM/yyyy" mode="popup" size="19" required="true">					
									<f:convertDateTime pattern="dd/MM/yyyy" />
									<f:passThroughAttribute name="required" value="true" />					
								</p:calendar>							
							</p:column>
						</p:row>
						<p:row>  
		        			<p:column> 
								<h:outputLabel id="applicationPriceVersionLabelUpdate" for="applicationPriceVersionUpdate"
									value="#{i18n.versionPriceLabel} " />
							</p:column>
							<p:column styleClass="center">
								<h:inputText id="applicationPriceVersionUpdate" value="#{applicationBean.applicationUpdate.price}">
									<f:convertNumber minFractionDigits="2" />
								</h:inputText>							
							</p:column>
						</p:row>
						<p:row>  
		        			<p:column> 
								<h:outputLabel id="applicationToDoLabelUpdate" for="applicationToDoUpdate"
									value="#{i18n.toDoLabel} " />
							</p:column>
							<p:column styleClass="center">
								<h:inputText id="applicationToDoUpdate" value="#{applicationBean.applicationUpdate.toDo}" />							
							</p:column>
						</p:row>						
						<p:row>  
		        			<p:column> 
								<h:outputLabel id="applicationCommentsLabelUpdate" for="applicationCommentsUpdate"
									value="#{i18n.commentsLabel} " />
							</p:column>
							<p:column styleClass="center">
								<p:inputTextarea id="applicationCommentsUpdate" 
									value="#{applicationBean.applicationUpdate.comments}" rows="3" cols="19" />
							</p:column>
						</p:row>
						<p:row>  
		        			<p:column> 
								<h:outputLabel id="applicationCommentsLabelHistory" for="applicationCommentsHistory"
									value="#{i18n.archive} " />
							</p:column>
							<p:column styleClass="center">
								<p:inputTextarea id="applicationCommentsHistory" 
									value="#{applicationBean.applicationHistory.comments}" rows="3" cols="19" />
							</p:column>
						</p:row>
						<f:facet name="footer">
				            <p:row>  
					            <p:column colspan="2" styleClass="center">
					                <p:commandButton id="updateApplicationFormSubmit" action="#{applicationBean.update}" 
					                	value="#{i18n.update}" oncomplete="updateApplicationDlg.hide()"
					                	update=":applicationForm:applicationGrowl, :applicationForm:dataTableAllApplication,
					                	:detailApplicationForm:panelDetailApplication" />					                				                	    	
								</p:column>
							</p:row>
		       			</f:facet>	
					</p:panelGrid>
				</p:dialog>
			</h:form>
		
		<!-- **************************************** Module Details **************************************** -->
			
			<h:form id="detailModuleForm" prependId="false">
				<p:panel header="#{i18n.moduleDetailLabel}" id="panelDetailModule">
					<h:panelGrid columns="2">
						<h:outputLabel value="#{i18n.moduleIdLabel}" />
						<h:outputText value="#{moduleBean.moduleView.idModule}" />
						
						<h:outputLabel value="#{i18n.moduleNameLabel}" />
						<h:outputText value="#{moduleBean.moduleView.name}" />
						
						<h:outputLabel value="#{i18n.typeNameLabel}" />
						<h:outputText value="#{moduleBean.moduleView.type.name}" />
						
						<h:outputLabel value="#{i18n.versionNameLabel}" />
						<h:outputText value="#{moduleBean.moduleView.version}" />
						
						<h:outputLabel value="#{i18n.versionDateLabel}" />
						<h:outputText value="#{moduleBean.moduleView.date}">
							<f:convertDateTime pattern="dd/MM/yyyy" />
						</h:outputText>
						
						<h:outputLabel value="#{i18n.versionPriceLabel}" />
						<h:outputText value="#{moduleBean.moduleView.price}">
							<f:convertNumber minFractionDigits="2" />
						</h:outputText>
						
						<h:outputLabel value="#{i18n.toDoLabel}" />
						<h:outputText value="#{moduleBean.moduleView.toDo}" />
						
						<h:outputLabel value="#{i18n.commentsLabel}" />
						<h:outputText value="#{moduleBean.moduleView.comments}" />
						
						<f:facet name="footer">
							<p:commandButton id="showUpdateModule" value="#{i18n.update}" icon="ui-icon-wrench"
								action="#{moduleBean.toggleUpdate}" oncomplete="updateModuleDlg.show()"
								update=":updateModuleForm:updateModuleDialog" />
							<p:commandButton id="deleteModuleSubmit" value="#{i18n.delete}" icon="ui-icon-trash"
								action="#{moduleBean.delete}" update=":applicationForm:applicationGrowl,
								:applicationForm:dataTableAllApplication, :detailModuleForm:panelDetailModule" />
						</f:facet>
					</h:panelGrid>
				</p:panel>
			</h:form>
				
		<!-- **************************************** Dialog Module update **************************************** -->
				
			<h:form id="updateModuleForm" prependId="false">
				<p:dialog id="updateModuleDialog" header="#{i18n.updateModuleLabel}" widgetVar="updateModuleDlg" 
			    	dynamic="true" showEffect="clip" hideEffect="scale">
			    	<p:panelGrid id="updateModulePanel" styleClass="span91">  					    				    
						<p:row>  
		        			<p:column> 
								<h:outputLabel id="moduleNameLabelUpdate" for="moduleNameUpdate"
									value="#{i18n.moduleNameLabel} " />
							</p:column>
							<p:column styleClass="center">
								<h:inputText id="moduleNameUpdate" value="#{moduleBean.moduleUpdate.name}">
									<f:passThroughAttribute name="required" value="true" />					
								</h:inputText>
							</p:column>
						</p:row>
						<p:row>  
		        			<p:column> 
								<h:outputLabel id="moduleTypeLabelUpdate" for="moduleTypeUpdate"
									value="#{i18n.typeNameLabel} " />
							</p:column>
							<p:column styleClass="center">
								<h:panelGroup>
									<p:selectOneMenu value="#{moduleBean.moduleUpdate.type}" filter="true" id="moduleTypeUpdate" 
										filterMatchMode="startsWith" required="true"
										converter="#{typeConverterBean}" validator="#{typeValidator.validate}"> 	
										<f:passThroughAttribute name="required" value="true" />	
										<f:selectItem itemLabel="Select One" itemValue="Select One" />						            	            
							            <f:selectItems value="#{listBean.listType}" var="type" 
							            	itemLabel="#{type.name}" itemValue="#{type}" />			           	            	
							        </p:selectOneMenu> 
							        <p:commandButton id="showAddTypeUM" icon="ui-icon-plus" 
										type="button" onclick="newTypeDlg.show()" />  			        
				       			</h:panelGroup> 																
							</p:column>
						</p:row>
						<p:row>  
		        			<p:column> 
								<h:outputLabel id="moduleVersionLabelUpdate" for="moduleVersionUpdate"
									value="#{i18n.versionNameLabel} " />
							</p:column>
							<p:column styleClass="center">
								<h:inputText id="moduleVersionUpdate" value="#{moduleBean.moduleUpdate.version}" />							
							</p:column>
						</p:row>
						<p:row>  
		        			<p:column> 
								<h:outputLabel id="moduleDateVersionLabelUpdate" for="moduleDateUpdate"
									value="#{i18n.versionDateLabel} " />
							</p:column>
							<p:column styleClass="center">								
								<p:calendar id="moduleDateUpdate" value="#{moduleBean.moduleUpdate.date}" 
									pattern="dd/MM/yyyy" mode="popup" size="19" required="true">					
									<f:convertDateTime pattern="dd/MM/yyyy" />
									<f:passThroughAttribute name="required" value="true" />					
								</p:calendar>							
							</p:column>
						</p:row>
						<p:row>  
		        			<p:column> 
								<h:outputLabel id="modulePriceVersionLabelUpdate" for="modulePriceUpdate"
									value="#{i18n.versionPriceLabel} " />
							</p:column>
							<p:column styleClass="center">
								<h:inputText id="modulePriceUpdate" value="#{moduleBean.moduleUpdate.price}" />							
							</p:column>
						</p:row>
						<p:row>  
		        			<p:column> 
								<h:outputLabel id="moduleToDoLabelUpdate" for="moduleToDoUpdate"
									value="#{i18n.toDoLabel} " />
							</p:column>
							<p:column styleClass="center">
								<h:inputText id="moduleToDoUpdate" value="#{moduleBean.moduleUpdate.toDo}" />							
							</p:column>
						</p:row>						
						<p:row>  
		        			<p:column> 
								<h:outputLabel id="moduleCommentsLabelUpdate" for="moduleCommentsUpdate"
									value="#{i18n.commentsLabel} " />
							</p:column>
							<p:column styleClass="center">
								<p:inputTextarea id="moduleCommentsUpdate" 
									value="#{moduleBean.moduleUpdate.comments}" rows="3" cols="19" />
							</p:column>
						</p:row>
						<p:row>  
		        			<p:column> 
								<h:outputLabel id="moduleCommentsLabelHistory" for="moduleCommentsHistory"
									value="#{i18n.archive} " />
							</p:column>
							<p:column styleClass="center">
								<p:inputTextarea id="moduleCommentsHistory" 
									value="#{moduleBean.moduleHistory.comments}" rows="3" cols="19" />
							</p:column>
						</p:row>
						<f:facet name="footer">
				            <p:row>  
					            <p:column colspan="2" styleClass="center">
					                <p:commandButton id="updateModuleFormSubmit" action="#{moduleBean.update}" 
					                	value="#{i18n.update}" oncomplete="updateModuleDlg.hide()"
					                	update=":applicationForm:applicationGrowl, :applicationForm:dataTableAllApplication,
					                	:detailModuleForm:panelDetailModule" />					                	    	
								</p:column>
							</p:row>
		       			</f:facet>	
					</p:panelGrid>
				</p:dialog>
			</h:form>
		</div>		
	</ui:define>	
</ui:composition>
</html>